import express from 'express';
import wyApi from '../../lib/wyapi'; // 维易接口API
import messageApi from '../../lib/messageapi'; // 消息通知相关API
import CONFIG from '../../../config/config.config'; // CONFIG
// import { checkPermission } from '../../utils/utils'; // 工具类

const router = express.Router();

router.get('/', async function (Request, Response, next) {
  let query = Request.query
  wyApi.superSearch({
    ...query,
    para: query.keyWords,
    page: query.pageNo,
    pagesize: query.pageSize,
    coupon: query.hasCoupon,
    similar: 1, // 如果商品是非淘宝联盟的商品，则接口会使用它的标题去搜索相拟产品
  }).then(res => {
    Response.json({
      data: res.result_list
    })
  })
});

module.exports = router;